package com.itheima.web.controller;

import com.itheima.domain.Dept;
import com.itheima.domain.ResultInfo;
import com.itheima.service.DeptService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/dept")
public class DeptController {

    private DeptService deptService;

    public DeptController(DeptService deptService) {
        this.deptService = deptService;
    }

    @GetMapping
    public ResultInfo findDeptList(){
        List<Dept> deptList = deptService.findDeptList();
        return new ResultInfo(true, "查询", deptList);
    }
}
